import 'package:ycbl/common/my_course_type.dart';
import 'package:ycbl/model/bl_error_entity.dart';
import 'package:ycbl/model/learn_task_list_entity.dart';
import 'package:ycbl/net/repository/bl_repository.dart';
import 'package:ycbl/widget/provider/base_view_state_list_model.dart';

class LearnTaskListViewModel extends BaseViewStateListModel<LearnTaskEntity> {

  ///课程类型 是不可变的
  final MyCourseType courseType;
  final int mainId;

  LearnTaskListViewModel(this.mainId, this.courseType);

  @override
  internalLoadData({int startIndex, Function(List<LearnTaskEntity> list) onListSuccess, Function(BLErrorEntity error) onListError}) {
    if (courseType == MyCourseType.CLAZZ) { // 班课
      BLRepository.getLearnClassTaskList(mainId, startIndex, pageSize, onListSuccess, onListError);
    }else { // 一对一
      BLRepository.getLearnOneTaskList(mainId, startIndex, pageSize, onListSuccess, onListError);
    }
  }


}